@ECHO OFF
SETLOCAL

:: Command line parsing
SET File2Print=%*
ECHO.%File2Print% | FIND "?" >NUL
IF NOT ERRORLEVEL 1 GOTO Syntax
:: Strip leading space in NT 4 only
VER | FIND "Windows NT" >NUL
IF NOT ERRORLEVEL 1 IF DEFINED File2Print SET File2Print=%File2Print:~1%
IF DEFINED File2Print SET File2Print=%File2Print:"=%
IF NOT DEFINED File2Print GOTO Syntax
IF NOT EXIST "%File2Print:"=%" GOTO Syntax

:: Actual print command
RUNDLL32.EXE MSHTML.DLL,PrintHTML "%File2Print%"

:: Done
GOTO End

:Syntax
ECHO.
ECHO PrintHTM.bat,  Version 1.11 for Windows NT
ECHO Prints a local HTML file from the command line
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
ECHO.
ECHO Usage:  %~n0  ^<html_file^>

:End
ENDLOCAL
